using CfgTable;
using IQIGame.Onigao.Framework;

namespace IQIGame.Onigao.GamePlay
{
    public abstract class BaseNonLevelExecution : IReusableClass
    {
        protected TViewEntity _host;
        protected CfgNonLevelExecution _cfgExecution;
        //兼容关卡逻辑层的定义
        protected TViewEntity triggerEntity => _host;

        public uint MaxStore => 100;

        public void Init(CfgNonLevelExecution cfgExecution)
        {
            this._cfgExecution = cfgExecution;
        }

        public void InitHost(TViewEntity host)
        {
            this._host = host;
        }

        public virtual void Execute()
        {
            OnExecute(_cfgExecution);
        }

        protected abstract void OnExecute(CfgNonLevelExecution cfgExecution);

        public virtual void OnReset()
        {
            _host = null;
            _cfgExecution = null;
            OnPoolReset();
        }

        protected abstract void OnPoolReset();
    }
}
